<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!--使用CDN方式引入vue-->
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.4/vue.min.js"></script>
</head>
<body>
<h1>Vue的计算属性</h1>
<hr>
<div id="example">
    <p>{{ now }}</p>

    <p>{{ nowTime() }}</p>
</div>

<script>
    var vm = new Vue({
        el: '#example',
        data: {
            message: 'Hello'
        },
        computed: {
            now: function () {
                return Date.now()
            }
        },
        methods: {
            nowTime: function () {
                return Date.now()
            }
        }
    })
</script>
</body>
</html>
